package it.mp.multitask.preference;

import it.mp.multitask.R;
import it.mp.multitask.adapter.BackgroundAdapter;
import it.mp.multitask.utility.PatternEntry;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.os.Bundle;
import android.preference.ListPreference;
import android.util.AttributeSet;
import android.view.View;

public class BackgroundListPreference extends ListPreference {

	public BackgroundListPreference(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	@Override
	protected void showDialog(Bundle state) {
		super.showDialog(state);
	}
	@Override
	protected void onPrepareDialogBuilder(Builder builder) {
		int standardLayout = Integer.parseInt(getPreferenceManager().getSharedPreferences().getString(
				getContext().getResources().getString(R.string.theme_main_new), "0"));
		builder.setAdapter(new BackgroundAdapter(this.getContext(), PatternEntry.getChiavi(standardLayout), PatternEntry.getValori(standardLayout),
				standardLayout), null);
		super.onPrepareDialogBuilder(builder);

	}
	@Override
	protected View onCreateDialogView() {
		View v = super.onCreateDialogView();
		return v;
	}
}
